package Practice.Practice_01;

public class InterfaceTest_02 {
    public static void main(String[] args) {

    }
}
//接口
interface CompareObject{
    public int compareTo(Object o);//若返回值是0，代表相等;若为整数，代表当前对象大;负数表示当前对象小
}
//圆类
class Circle{
    private double radius;
    public void setRadius(double radius){
        this.radius=radius;
    }

    public double getRadius() {
        return radius;
    }
}
class CompareCircle extends Circle implements CompareObject{
    public int compareTo(Object o){
        if(this==o){
            return 0;
        }
        if(o instanceof CompareObject){
            CompareCircle compareCircle=(CompareCircle) o;
            if(this.getRadius()>(compareCircle.getRadius())){
                return 1;
            }else{
                return -1;
            }
        }
        return 0;
    }
}
